<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />

  <title>Class: TJPlurker</title>

  <link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />

  <script src="./js/jquery.js" type="text/javascript" charset="utf-8"></script>
  <script src="./js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
  <script src="./js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
  <script src="./js/darkfish.js" type="text/javascript" charset="utf-8"></script>

</head>
<body id="top" class="class">

  <div id="metadata">
    <div id="home-metadata">
      <div id="home-section" class="section">
        <h3 class="section-header">
          <a href="./index.html">Home</a>
          <a href="./index.html#classes">Classes</a>
          <a href="./index.html#methods">Methods</a>
        </h3>
      </div>
    </div>

    <div id="file-metadata">
      <div id="file-list-section" class="section">
        <h3 class="section-header">In Files</h3>
        <div class="section-body">
          <ul>
          
            <li><a href="./lib/tjplurker_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
              class="thickbox" title="lib/tjplurker.rb">lib/tjplurker.rb</a></li>
          
          </ul>
        </div>
      </div>

      
    </div>

    <div id="class-metadata">
      
      <!-- Parent Class -->
      <div id="parent-class-section" class="section">
        <h3 class="section-header">Parent</h3>
        
        <p class="link">Object</p>
        
      </div>
      

      

      
      <!-- Namespace Contents -->
      <div id="namespace-list-section" class="section">
        <h3 class="section-header">Namespace</h3>
        <ul class="link-list">
          
          <li><span class="type">CLASS</span> <a href="TJPlurker/NotificationData.html">TJPlurker::NotificationData</a></li>
          
          <li><span class="type">CLASS</span> <a href="TJPlurker/Robot.html">TJPlurker::Robot</a></li>
          
          <li><span class="type">CLASS</span> <a href="TJPlurker/Service.html">TJPlurker::Service</a></li>
          
          <li><span class="type">CLASS</span> <a href="TJPlurker/ThreadService.html">TJPlurker::ThreadService</a></li>
          
        </ul>
      </div>
      

      
      <!-- Method Quickref -->
      <div id="method-list-section" class="section">
        <h3 class="section-header">Methods</h3>
        <ul class="link-list">
          
          <li><a href="#method-c-new">::new</a></li>
          
          <li><a href="#method-i-add_all_as_friends">#add_all_as_friends</a></li>
          
          <li><a href="#method-i-become_fan">#become_fan</a></li>
          
          <li><a href="#method-i-comet_channel">#comet_channel</a></li>
          
          <li><a href="#method-i-get_friend_list">#get_friend_list</a></li>
          
          <li><a href="#method-i-get_friends_by_offset">#get_friends_by_offset</a></li>
          
          <li><a href="#method-i-get_plurks">#get_plurks</a></li>
          
          <li><a href="#method-i-get_public_profile">#get_public_profile</a></li>
          
          <li><a href="#method-i-get_user_channel">#get_user_channel</a></li>
          
          <li><a href="#method-i-login">#login</a></li>
          
          <li><a href="#method-i-plurk_add">#plurk_add</a></li>
          
          <li><a href="#method-i-response_add">#response_add</a></li>
          
          <li><a href="#method-i-super_become_fan">#super_become_fan</a></li>
          
        </ul>
      </div>
      

      
    </div>

    <div id="project-metadata">
      
      

      <div id="classindex-section" class="section project-section">
        <h3 class="section-header">Class/Module Index
          <span class="search-toggle"><img src="./images/find.png"
            height="16" width="16" alt="[+]"
            title="show/hide quicksearch" /></span></h3>
        <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
        <fieldset>
          <legend>Quicksearch</legend>
          <input type="text" name="quicksearch" value=""
            class="quicksearch-field" />
        </fieldset>
        </form>

        <ul class="link-list">
        
          <li><a href="./TJPlurker.html">TJPlurker</a></li>
        
          <li><a href="./TJPlurker/NotificationData.html">TJPlurker::NotificationData</a></li>
        
          <li><a href="./TJPlurker/Robot.html">TJPlurker::Robot</a></li>
        
          <li><a href="./TJPlurker/Service.html">TJPlurker::Service</a></li>
        
          <li><a href="./TJPlurker/ThreadService.html">TJPlurker::ThreadService</a></li>
        
        </ul>
        <div id="no-class-search-results" style="display: none;">No matching classes.</div>
      </div>

      
    </div>
  </div>

  <div id="documentation">
    <h1 class="class">TJPlurker</h1>

    <div id="description" class="description">
      
<p>It’s a wrapper of Plurk API. Note that every methods in this class returns
a JSON object which was converted from Plurk server’s response. All mehtods
will retry again when request timeout occurs.</p>

    </div><!-- description -->

    
    <div id="5Buntitled-5D" class="documentation-section">
      

      

      

      
      <!-- Attributes -->
      <div id="attribute-method-details" class="method-section section">
        <h3 class="section-header">Attributes</h3>

        
        <div id="user-attribute-method" class="method-detail">
          <a name="user"></a>
          
          <div class="method-heading attribute-method-heading">
            <span class="method-name">user</span><span
              class="attribute-access-type">[R]</span>
          </div>

          <div class="method-description">
          
          <p>Plurk user ID.</p>
          
          </div>
        </div>
        
      </div><!-- attribute-method-details -->
      

      <!-- Methods -->
      
      <div id="public-class-method-details" class="method-section section">
        <h3 class="section-header">Public Class Methods</h3>

      
        <div id="new-method" class="method-detail ">
          <a name="method-c-new"></a>

          
          <div class="method-heading">
            <span class="method-name">new</span><span
              class="method-args">(api_key, user, passwd, auto_login=true)</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>If <tt>auto_login</tt> sets <tt>true</tt>, it will autologin while
constructing.</p>
            

            
            <div class="method-source-code" id="new-source">
<pre>
<span class="ruby-comment"># File lib/tjplurker.rb, line 20</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span> <span class="ruby-identifier">api_key</span>, <span class="ruby-identifier">user</span>, <span class="ruby-identifier">passwd</span>, <span class="ruby-identifier">auto_login</span>=<span class="ruby-keyword">true</span>
    <span class="ruby-ivar">@user</span>, <span class="ruby-ivar">@passwd</span>, <span class="ruby-ivar">@api_key</span> = <span class="ruby-identifier">user</span>, <span class="ruby-identifier">passwd</span>, <span class="ruby-identifier">api_key</span>
    <span class="ruby-ivar">@cookie</span> = <span class="ruby-keyword">nil</span>
    <span class="ruby-ivar">@user_channel</span> = <span class="ruby-keyword">nil</span>
    <span class="ruby-ivar">@id_buffer</span> = <span class="ruby-keyword">nil</span>
    <span class="ruby-identifier">login</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">auto_login</span>
<span class="ruby-keyword">end</span></pre>
            </div><!-- new-source -->
            
          </div>

          

          
        </div><!-- new-method -->

      
      </div><!-- public-class-method-details -->
    
      <div id="public-instance-method-details" class="method-section section">
        <h3 class="section-header">Public Instance Methods</h3>

      
        <div id="add_all_as_friends-method" class="method-detail ">
          <a name="method-i-add_all_as_friends"></a>

          
          <div class="method-heading">
            <span class="method-name">add_all_as_friends</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            
            

            
            <div class="method-source-code" id="add_all_as_friends-source">
<pre>
<span class="ruby-comment"># File lib/tjplurker.rb, line 71</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">add_all_as_friends</span>
    <span class="ruby-identifier">method</span> = <span class="ruby-string">&quot;/API/Alerts/addAllAsFriends&quot;</span>
    <span class="ruby-identifier">attr</span> = {<span class="ruby-value">:api_key=</span><span class="ruby-operator">&gt;</span><span class="ruby-ivar">@api_key</span>}
    <span class="ruby-identifier">api</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">attr</span>)
<span class="ruby-keyword">end</span></pre>
            </div><!-- add_all_as_friends-source -->
            
          </div>

          

          
        </div><!-- add_all_as_friends-method -->

      
        <div id="become_fan-method" class="method-detail ">
          <a name="method-i-become_fan"></a>

          
          <div class="method-heading">
            <span class="method-name">become_fan</span><span
              class="method-args">(fan_id)</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            
            

            
            <div class="method-source-code" id="become_fan-source">
<pre>
<span class="ruby-comment"># File lib/tjplurker.rb, line 52</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">become_fan</span> <span class="ruby-identifier">fan_id</span>
    <span class="ruby-identifier">method</span> = <span class="ruby-string">&quot;/API/FriendsFans/becomeFan&quot;</span>
    <span class="ruby-identifier">attr</span> = {<span class="ruby-value">:api_key=</span><span class="ruby-operator">&gt;</span><span class="ruby-ivar">@api_key</span>, <span class="ruby-value">:fan_id=</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">fan_id</span>}
    <span class="ruby-identifier">api</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">attr</span>)
<span class="ruby-keyword">end</span></pre>
            </div><!-- become_fan-source -->
            
          </div>

          

          
        </div><!-- become_fan-method -->

      
        <div id="comet_channel-method" class="method-detail ">
          <a name="method-i-comet_channel"></a>

          
          <div class="method-heading">
            <span class="method-name">comet_channel</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            
            

            
            <div class="method-source-code" id="comet_channel-source">
<pre>
<span class="ruby-comment"># File lib/tjplurker.rb, line 121</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">comet_channel</span>
    <span class="ruby-comment">#Assign new channel if @user_channel is nil</span>
    <span class="ruby-ivar">@user_channel</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">get_user_channel</span>
    <span class="ruby-keyword">begin</span>
        <span class="ruby-identifier">res</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">get_response</span>(<span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-ivar">@user_channel</span>[<span class="ruby-string">'comet_server'</span>]))
        <span class="ruby-identifier">json</span> = <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">res</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp">/CometChannel\.scriptCallback\((.*)\);/</span>){<span class="ruby-operator">|</span><span class="ruby-identifier">match</span><span class="ruby-operator">|</span> <span class="ruby-node">$1</span>})
    <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Timeout</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ex</span>
        <span class="ruby-identifier">$tjpLog</span>.<span class="ruby-identifier">warn</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>){<span class="ruby-string">&quot;Request timeout, retry.&quot;</span>}
        <span class="ruby-keyword">retry</span>
    <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ECONNRESET</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ex</span>
        <span class="ruby-identifier">$tjpLog</span>.<span class="ruby-identifier">warn</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>){<span class="ruby-string">&quot;Connection reset, retry.&quot;</span>}
        <span class="ruby-keyword">retry</span>
    <span class="ruby-keyword">rescue</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ex</span>
        <span class="ruby-identifier">$tjpLog</span>.<span class="ruby-identifier">fatal</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>){<span class="ruby-string">&quot;Unknown error, skip.&quot;</span>}
        <span class="ruby-identifier">puts</span> <span class="ruby-identifier">ex</span>.<span class="ruby-identifier">class</span>, <span class="ruby-identifier">ex</span>.<span class="ruby-identifier">message</span>, <span class="ruby-identifier">ex</span>.<span class="ruby-identifier">backtrace</span>
        <span class="ruby-keyword">return</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-comment">#Update the offset</span>
    <span class="ruby-ivar">@user_channel</span>[<span class="ruby-string">'comet_server'</span>].<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp">/[\d]+$/</span>, <span class="ruby-identifier">json</span>[<span class="ruby-string">&quot;new_offset&quot;</span>].<span class="ruby-identifier">to_s</span>)
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">json</span>[<span class="ruby-string">'data'</span>]
        <span class="ruby-identifier">json</span>[<span class="ruby-string">'data'</span>].<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">member</span><span class="ruby-operator">|</span>
            <span class="ruby-identifier">notification</span> = <span class="ruby-constant">NotificationData</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">member</span>)
            <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">notification</span>.<span class="ruby-identifier">id</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@id_buffer</span>
            <span class="ruby-identifier">$tjpLog</span>.<span class="ruby-identifier">info</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>){<span class="ruby-node">&quot;Notification: #{notification.user_id}: \&quot;#{notification.content}\&quot;&quot;</span>}
            <span class="ruby-ivar">@id_buffer</span> = <span class="ruby-identifier">notification</span>.<span class="ruby-identifier">id</span>
            <span class="ruby-keyword">yield</span>(<span class="ruby-identifier">notification</span>)
        }
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">json</span>
<span class="ruby-keyword">end</span></pre>
            </div><!-- comet_channel-source -->
            
          </div>

          

          
        </div><!-- comet_channel-method -->

      
        <div id="get_friend_list-method" class="method-detail ">
          <a name="method-i-get_friend_list"></a>

          
          <div class="method-heading">
            <span class="method-name">get_friend_list</span><span
              class="method-args">(user_id, max=nil)</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>This method is provided by <a href="TJPlurker.html">TJPlurker</a>.</p>
<table class="rdoc-list"><tr><td class="rdoc-term"><p><tt>max</tt></p></td>
<td>
<p>The maximum number of your request</p>
</td></tr><tr><td class="rdoc-term"><p><tt>return</tt></p></td>
<td>
<p>An array contains friends</p>
</td></tr></table>
            

            
            <div class="method-source-code" id="get_friend_list-source">
<pre>
<span class="ruby-comment"># File lib/tjplurker.rb, line 80</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_friend_list</span> <span class="ruby-identifier">user_id</span>, <span class="ruby-identifier">max</span>=<span class="ruby-keyword">nil</span>
    <span class="ruby-identifier">list</span> = []
    <span class="ruby-identifier">offset</span> = <span class="ruby-value">0</span>;
    <span class="ruby-identifier">loop</span>{
        <span class="ruby-identifier">set</span> = <span class="ruby-identifier">get_friends_by_offset</span>(<span class="ruby-identifier">user_id</span>, <span class="ruby-value">100</span>, <span class="ruby-identifier">offset</span>)
        <span class="ruby-identifier">size</span> = <span class="ruby-identifier">set</span>.<span class="ruby-identifier">size</span>
        <span class="ruby-keyword">break</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
        <span class="ruby-identifier">list</span> <span class="ruby-operator">|=</span> <span class="ruby-identifier">set</span>
        <span class="ruby-keyword">break</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">max</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">list</span>.<span class="ruby-identifier">size</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">max</span>
        <span class="ruby-identifier">offset</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">size</span>
    }
    <span class="ruby-keyword">return</span> <span class="ruby-identifier">list</span>
<span class="ruby-keyword">end</span></pre>
            </div><!-- get_friend_list-source -->
            
          </div>

          

          
        </div><!-- get_friend_list-method -->

      
        <div id="get_friends_by_offset-method" class="method-detail ">
          <a name="method-i-get_friends_by_offset"></a>

          
          <div class="method-heading">
            <span class="method-name">get_friends_by_offset</span><span
              class="method-args">(user_id, limit=100, offset='0')</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>This maximum limit is set 100 officially, this method is not that useful.
We suggest you use <a
href="TJPlurker.html#method-i-get_friend_list">get_friend_list</a> instead
of get_friends_by_offset.</p>
            

            
            <div class="method-source-code" id="get_friends_by_offset-source">
<pre>
<span class="ruby-comment"># File lib/tjplurker.rb, line 96</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_friends_by_offset</span> <span class="ruby-identifier">user_id</span>, <span class="ruby-identifier">limit</span>=<span class="ruby-value">100</span>, <span class="ruby-identifier">offset</span>=<span class="ruby-string">'0'</span>
    <span class="ruby-identifier">method</span> = <span class="ruby-string">&quot;/API/FriendsFans/getFriendsByOffset&quot;</span>
    <span class="ruby-identifier">attr</span> = {<span class="ruby-value">:api_key=</span><span class="ruby-operator">&gt;</span><span class="ruby-ivar">@api_key</span>, <span class="ruby-value">:user_id=</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">user_id</span>, <span class="ruby-value">:offset=</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">offset</span>, <span class="ruby-value">:limit=</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">limit</span>}
    <span class="ruby-identifier">api</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">attr</span>)
<span class="ruby-keyword">end</span></pre>
            </div><!-- get_friends_by_offset-source -->
            
          </div>

          

          
        </div><!-- get_friends_by_offset-method -->

      
        <div id="get_plurks-method" class="method-detail ">
          <a name="method-i-get_plurks"></a>

          
          <div class="method-heading">
            <span class="method-name">get_plurks</span><span
              class="method-args">(limit=nil, offset=nil)</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <table class="rdoc-list"><tr><td class="rdoc-term"><p>Warning</p></td>
<td>
<p>It has bugs in offecial Plurk API.</p>
</td></tr></table>
            

            
            <div class="method-source-code" id="get_plurks-source">
<pre>
<span class="ruby-comment"># File lib/tjplurker.rb, line 109</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_plurks</span> <span class="ruby-identifier">limit</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-identifier">offset</span>=<span class="ruby-keyword">nil</span>
    <span class="ruby-identifier">method</span> = <span class="ruby-string">&quot;/API/Polling/getPlurks&quot;</span>
    <span class="ruby-identifier">attr</span> = {<span class="ruby-value">:api_key=</span><span class="ruby-operator">&gt;</span><span class="ruby-ivar">@api_key</span>, <span class="ruby-value">:limit=</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">limit</span>, <span class="ruby-value">:offset=</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">offset</span>}
    <span class="ruby-identifier">api</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">attr</span>)
<span class="ruby-keyword">end</span></pre>
            </div><!-- get_plurks-source -->
            
          </div>

          

          
        </div><!-- get_plurks-method -->

      
        <div id="get_public_profile-method" class="method-detail ">
          <a name="method-i-get_public_profile"></a>

          
          <div class="method-heading">
            <span class="method-name">get_public_profile</span><span
              class="method-args">(user_id)</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            
            

            
            <div class="method-source-code" id="get_public_profile-source">
<pre>
<span class="ruby-comment"># File lib/tjplurker.rb, line 102</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_public_profile</span> <span class="ruby-identifier">user_id</span>
    <span class="ruby-identifier">method</span> = <span class="ruby-string">&quot;/API/Profile/getPublicProfile&quot;</span>
    <span class="ruby-identifier">attr</span> = {<span class="ruby-value">:api_key=</span><span class="ruby-operator">&gt;</span><span class="ruby-ivar">@api_key</span>, <span class="ruby-value">:user_id=</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">user_id</span>}
    <span class="ruby-identifier">api</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">attr</span>)
<span class="ruby-keyword">end</span></pre>
            </div><!-- get_public_profile-source -->
            
          </div>

          

          
        </div><!-- get_public_profile-method -->

      
        <div id="get_user_channel-method" class="method-detail ">
          <a name="method-i-get_user_channel"></a>

          
          <div class="method-heading">
            <span class="method-name">get_user_channel</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            
            

            
            <div class="method-source-code" id="get_user_channel-source">
<pre>
<span class="ruby-comment"># File lib/tjplurker.rb, line 115</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_user_channel</span>
    <span class="ruby-identifier">method</span> = <span class="ruby-string">&quot;/API/Realtime/getUserChannel&quot;</span>
    <span class="ruby-identifier">attr</span> = {<span class="ruby-value">:api_key=</span><span class="ruby-operator">&gt;</span><span class="ruby-ivar">@api_key</span>}
    <span class="ruby-identifier">api</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">attr</span>)
<span class="ruby-keyword">end</span></pre>
            </div><!-- get_user_channel-source -->
            
          </div>

          

          
        </div><!-- get_user_channel-method -->

      
        <div id="login-method" class="method-detail ">
          <a name="method-i-login"></a>

          
          <div class="method-heading">
            <span class="method-name">login</span><span
              class="method-args">(no_data=true)</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>If no_data sets true, the successful login message was simplified as
follow:</p>

<pre>{&quot;success_text&quot;: &quot;ok&quot;}</pre>

<p>Otherwise, more details of user’s profile were retured.</p>
            

            
            <div class="method-source-code" id="login-source">
<pre>
<span class="ruby-comment"># File lib/tjplurker.rb, line 33</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">login</span> <span class="ruby-identifier">no_data</span>=<span class="ruby-keyword">true</span>
    <span class="ruby-identifier">method</span> = <span class="ruby-string">&quot;/API/Users/login&quot;</span>
    <span class="ruby-identifier">attr</span> = {<span class="ruby-value">:username=</span><span class="ruby-operator">&gt;</span><span class="ruby-ivar">@user</span>, <span class="ruby-value">:password=</span><span class="ruby-operator">&gt;</span><span class="ruby-ivar">@passwd</span>, <span class="ruby-value">:api_key=</span><span class="ruby-operator">&gt;</span><span class="ruby-ivar">@api_key</span>}
    <span class="ruby-identifier">attr</span>[<span class="ruby-value">:no_data</span>] = <span class="ruby-string">'1'</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">no_data</span>
    <span class="ruby-identifier">api</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">attr</span>)
<span class="ruby-keyword">end</span></pre>
            </div><!-- login-source -->
            
          </div>

          

          
        </div><!-- login-method -->

      
        <div id="plurk_add-method" class="method-detail ">
          <a name="method-i-plurk_add"></a>

          
          <div class="method-heading">
            <span class="method-name">plurk_add</span><span
              class="method-args">(content, qualifier=':', limited_to=nil, no_comments=nil, lang='tr_ch')</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            
            

            
            <div class="method-source-code" id="plurk_add-source">
<pre>
<span class="ruby-comment"># File lib/tjplurker.rb, line 40</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">plurk_add</span> <span class="ruby-identifier">content</span>, <span class="ruby-identifier">qualifier</span>=<span class="ruby-string">':'</span>, <span class="ruby-identifier">limited_to</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-identifier">no_comments</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-identifier">lang</span>=<span class="ruby-string">'tr_ch'</span>
    <span class="ruby-identifier">method</span> = <span class="ruby-string">&quot;/API/Timeline/plurkAdd&quot;</span>
    <span class="ruby-identifier">attr</span> = {<span class="ruby-value">:api_key=</span><span class="ruby-operator">&gt;</span><span class="ruby-ivar">@api_key</span>, <span class="ruby-value">:content=</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">content</span>, <span class="ruby-value">:qualifier=</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">qualifier</span>,<span class="ruby-value">:limited_to=</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">limited_to</span>, <span class="ruby-value">:no_comments=</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">no_comments</span>, <span class="ruby-value">:lang=</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">lang</span>}
    <span class="ruby-identifier">api</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">attr</span>)
<span class="ruby-keyword">end</span></pre>
            </div><!-- plurk_add-source -->
            
          </div>

          

          
        </div><!-- plurk_add-method -->

      
        <div id="response_add-method" class="method-detail ">
          <a name="method-i-response_add"></a>

          
          <div class="method-heading">
            <span class="method-name">response_add</span><span
              class="method-args">(plurk_id, content, qualifier=':')</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            
            

            
            <div class="method-source-code" id="response_add-source">
<pre>
<span class="ruby-comment"># File lib/tjplurker.rb, line 46</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">response_add</span> <span class="ruby-identifier">plurk_id</span>, <span class="ruby-identifier">content</span>, <span class="ruby-identifier">qualifier</span>=<span class="ruby-string">':'</span>
    <span class="ruby-identifier">method</span> = <span class="ruby-string">&quot;/API/Responses/responseAdd&quot;</span>
    <span class="ruby-identifier">attr</span> = {<span class="ruby-value">:api_key=</span><span class="ruby-operator">&gt;</span><span class="ruby-ivar">@api_key</span>, <span class="ruby-value">:plurk_id=</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">plurk_id</span>, <span class="ruby-value">:content=</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">content</span>, <span class="ruby-value">:qualifier=</span><span class="ruby-operator">&gt;</span><span class="ruby-identifier">qualifier</span>}
    <span class="ruby-identifier">api</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">attr</span>)
<span class="ruby-keyword">end</span></pre>
            </div><!-- response_add-source -->
            
          </div>

          

          
        </div><!-- response_add-method -->

      
        <div id="super_become_fan-method" class="method-detail ">
          <a name="method-i-super_become_fan"></a>

          
          <div class="method-heading">
            <span class="method-name">super_become_fan</span><span
              class="method-args">(fan_id, level=1)</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>This method is provided by <a href="TJPlurker.html">TJPlurker</a>.</p>
            

            
            <div class="method-source-code" id="super_become_fan-source">
<pre>
<span class="ruby-comment"># File lib/tjplurker.rb, line 59</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">super_become_fan</span> <span class="ruby-identifier">fan_id</span>, <span class="ruby-identifier">level</span>=<span class="ruby-value">1</span>
    <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">level</span><span class="ruby-operator">&lt;=</span><span class="ruby-value">0</span>
    <span class="ruby-identifier">become_fan</span>(<span class="ruby-identifier">fan_id</span>)
    <span class="ruby-identifier">list</span> = <span class="ruby-identifier">get_friend_list</span>(<span class="ruby-identifier">fan_id</span>)
    <span class="ruby-identifier">list</span>.<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
        <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;#{i[&quot;uid&quot;]} #{become_fan(i[&quot;uid&quot;])}&quot;</span>
    }
    <span class="ruby-identifier">list</span>.<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
        <span class="ruby-identifier">super_become_fan</span>(<span class="ruby-identifier">i</span>[<span class="ruby-string">&quot;uid&quot;</span>], <span class="ruby-identifier">level</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>)
    }
<span class="ruby-keyword">end</span></pre>
            </div><!-- super_become_fan-source -->
            
          </div>

          

          
        </div><!-- super_become_fan-method -->

      
      </div><!-- public-instance-method-details -->
    
    </div><!-- 5Buntitled-5D -->
  

  </div><!-- documentation -->

  <div id="validator-badges">
    <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
    <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
      Rdoc Generator</a> 2</small>.</p>
  </div>

</body>
</html>

